import subprocess
import time
from pywinauto.keyboard import send_keys
import pyautogui
import uiautomation
import os

# uiautomation.PaneControl(AutomationId='59419').ButtonControl(SearchDepth=10, Name='Import').Click()
# uiautomation.ButtonControl(Depth=3, Name='No', AutomationId="7").Click()
# uiautomation.ButtonControl(AutomationId="1102", Name='File Name').Click()
# send_keys('Oakmark_custom - Copy.xlsx')
# uiautomation.EditControl(AutomationId="1148", Name='File name:',  ClassName="Edit").SendKeys('Oakmark_custom - Copy.xlsx')
# uiautomation.ButtonControl(AutomationId="1", Name='Open', Depth=4).Click()
rect = uiautomation.PaneControl(AutomationId="1103", Name='Custom1').BoundingRectangle
print(rect)
print(str(rect))
print(rect.left, rect.top, rect.right, rect.bottom, rect.width(), rect.height())
region = (rect.left, rect.top, rect.width(), rect.height())
print(region)
img = pyautogui.screenshot(region=region)
img.save('./1.png')
